package com.scut.edu.wanyou.util;

import java.io.File;
import java.io.FilenameFilter;
import java.util.regex.Pattern;

/**
 * Description:正则表达式过滤文件
 * RegexFileFilter.java Create on 2012-10-8 上午9:13:48 
 * @author SongXitong * @version 1.0
 * Copyright (c) 2012 Company,Inc. All Rights Reserved.
 */
public class RegexFileFilter implements FilenameFilter {
	
	private Pattern pattern;
	
	public RegexFileFilter(String regex){
		pattern = Pattern.compile(regex);
	}
	public boolean accept(File dir, String name) {
		// TODO Auto-generated method stub
		
		return pattern.matcher(name).matches();
		
	}

}
